package com.face.console.dao;

import com.face.console.pojo.vo.MenuVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AdminMenuMapper {

    //根据pid查询菜单全部信息
    @Select({"select",
            "id, pid, menu_name title, m_describe mDescribe, m_code mCode,url href,m_type mType,icon,target",
            "from face_menu ",
            "where  pid = ${pid}"})
    List<MenuVO> queryMenuList(@Param("pid") Long pid);


    @Select({"select",
            "id, pid, menu_name title, m_describe mDescribe, m_code mCode,url href,m_type mType,icon,target",
            "from face_menu "})
    List<MenuVO> queryAllMenus();

    @Select({"select",
            "id, pid, menu_name title, m_describe mDescribe, m_code mCode,url href,m_type mType,icon,target",
            "from face_menu ",
            "where id = #{id,jdbcType=BIGINT}"
    })
    MenuVO queryMenuById(Long id);

    //根据pid查询菜单全部信息
    @Select({" select",
            "id,pid",
            "from face_menu ",
            "where  pid = ${pid}"})
    List<MenuVO> queryMenuByPId(@Param("pid") Long pid);

    @Delete({
            "delete from face_menu",
            "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);


}